<%@ page import="com.example.ordersystem.domain.Customer" %><%--
  Created by IntelliJ IDEA.
  User: 檬zhu
  Date: 2021/12/13
  Time: 20:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<html>
<head>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/layui/css/layui.css">
</head>
<jsp:include page="title.jsp"/>
<body>
<%
    if(request.getSession().getAttribute("customeraddress") != null){
        String customeraddress = request.getSession().getAttribute("customeraddress").toString();



%>
<form name=alipayment action="${pageContext.request.contextPath}/customer/pay" method=post
     target="_blank"  class="layui-form layui-form-pane" style="margin-left: 20%">

    <div class="layui-form-item">
        <label class="layui-form-label">商户订单号</label>
        <div class="layui-input-inline">
            <input type="text" name="WIDout_trade_no" id="WIDout_trade_no"
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">用户名称</label>
        <div class="layui-input-inline">
            <input type="text" name="WIDsubject" id="WIDsubject"
                   class="layui-input" value="<%=((Customer)session.getAttribute("customer")).getName()%>" readonly="readonly">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">付款金额</label>
        <div class="layui-input-inline">
            <input type="text" name="WIDtotal_amount" id="WIDtotal_amount"
                   class="layui-input" value="<%=request.getParameter("total")%>" readonly="readonly">
        </div>
    </div>
    <input type="hidden" name="remark" value="<%=request.getParameter("remark")%>">
    <input type="hidden" name="customeraddress" value="<%=customeraddress%>">
    <div class="layui-form-item">
        <div class="layui-input-block" style="margin-left: 0">
            <button type="submit" class="layui-btn" data-type="content" lay-submit="" onclick="reloadPage()">确认付款</button>
        </div>
    </div>
    <span style="color: #999999;font-size: 12px;line-height: 130%;margin-top: 5px;width: 100%;display: block;">如果您点击“付款”按钮，即表示您同意该次的执行操作。</span>
</form>
<%
    }
%>
</body>
<script language="javascript">
    function GetDateNow() {
        var vNow = new Date();
        var sNow = "";
        sNow += String(vNow.getFullYear());
        sNow += String(vNow.getMonth() + 1);
        sNow += String(vNow.getDate());
        sNow += String(vNow.getHours());
        sNow += String(vNow.getMinutes());
        sNow += String(vNow.getSeconds());
        sNow += String(vNow.getMilliseconds());
        document.getElementById("WIDout_trade_no").value = sNow;
        document.getElementById("WIDout_trade_no").setAttribute("readonly",true)
    }
    GetDateNow();
    function reloadPage(){
        window.location.href='/customer/attentionPage';
    }
</script>

</html>
